open Castling;;

module CharPG = ParserGenerator (CharToken);;
open CharPG;;

let rec test = lazy !! (
	one_of ~name:"test" [
		"main", element 'M' >> clauses;
		"sub", element 'S' >> clause >> element 'B']
) and clauses = lazy !! (
	one_of ~name:"clauses" [
		"next", clause >> clauses;
		"end", element 'Z']
) and clause = lazy !! (
	one_of ~name:"clause" [
		"c1", element '(' >> select;
		"c2", element '2']
) and select = lazy !! (
	one_of ~name:"select" [
		"a", element 'A';
		"b", element 'T' >> element 'B']
);;

debug := true;;
runtime_debug := true;;
generate test;;
